(define n 30)
;=========================================
(display "direct recursion: ")
(define (fib n)
    (cond ((= n 0) 0)
        ((= n 1) 1)
        (else (+ (fib (- n 1)) (fib (- n 2))))))
        
(define t1 (real-time-clock))       
;(display (fib n))
(define t2 (real-time-clock))
(display "\ntime: ")
(display (- t2 t1))

;=========================================
(display "\niterative recursion: ")
(define (fibi n)
    (define (fibi-iter a b count)
        (if (>= count n)
             a
             (fibi-iter (+ a b) a (+ count 1))))
     (fibi-iter 1 0 1))
        
(define t3 (real-time-clock))       
(display (fibi n))
(define t4 (real-time-clock))
(display "\ntime: ")
(display (- t4 t3))

;=========================================
(display "\nfast recursion: ")
(define (fibi n)
    (define (fibi-iter a b count)
        (if (>= count n)
             a
             (fibi-iter (+ a b) a (+ count 1))))
     (fibi-iter 1 0 1))
        
(define t3 (real-time-clock))       
(display (fibi n))
(define t4 (real-time-clock))
(display "\ntime: ")
(display (- t4 t3))